export function handleSongsCetegory(data) {
  const category = data.categories;

  const categoryData = Object.entries(category).map(([key, value]) => {
    return {
      name: value,
      subs: []
    }
  })

  for (let item of data.subs) {
    categoryData[item.category].subs.push(item)
  }

  return categoryData
}


// 获取歌手字母类别
export function generateSingerAlpha() {
  var alphabets = [
    {
      value: '-1',
      name: '热门'
    }
  ];
  var start = 'A'.charCodeAt(0);
  var last = 'Z'.charCodeAt(0);
  for (var i = start; i <= last; ++i) {
    alphabets.push({ value: String.fromCharCode(i), name: String.fromCharCode(i) });
  }

  alphabets.push({
    value: '0',
    name: '其他'
  });

  return alphabets;
}

export const singerAlphas = generateSingerAlpha();